package com.heima.kafka.listener;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.pojos.User;
import org.springframework.stereotype.Component;

@Component
public class KafkaListener {

    @org.springframework.kafka.annotation.KafkaListener(topics = {"topic"})
    public void onMsg(String msg){
        System.out.println(msg);

        User user = JSON.parseObject(msg, User.class);
        System.out.println(user);
    }
}
